<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link href="__STATIC__admin/css/admin-min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__STATIC__admin/css/admin.css" />
<link href="__STATIC__admin/iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="__STATIC__admin/css/icheck/icheck.css" />
<link rel="stylesheet" type="text/css" href="__STATIC__admin/css/skin/default/skin.css" id="skin" />
<link href="__STATIC__admin/css/admin-style.css" rel="stylesheet" type="text/css" />

<link href="__STATIC__admin/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
    <a href="{:U('admin/info/index')}">分类信息管理</a><span class="c-gray en">&gt;</span>编辑信息
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container container">
	<form action="" method="post" class="form form-horizontal" id="form" enctype="multipart/form-data">


		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>标题：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" style="width: 30%;" value="{$data.title}" placeholder="" id="" name="title">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属栏目：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width: 30%;"> <span class="select-box">
				<select name="cid" class="select">
					<?php foreach($category as $k => $v){?>
						<option value="<?php echo $v['id']; ?>" <?php if($data['cid'] == $v['id']){?> selected="selected" <?php } ?> ><?php echo $v['_name'];?></option>
					<?php } ?>
				</select>
				</span> </div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>区域：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width: 30%;"> <span class="select-box">
				<select name="area" class="select">
					<?php foreach(C("city_area") as $k => $v){?>
						<option value="<?php echo $k; ?>" <?php if($data['area'] == $k){?> selected="selected" <?php } ?> ><?php echo $v;?></option>
					<?php } ?>
				</select>
				</span> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系人：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" style="width: 30%;" value="{$data.linkman}" placeholder="" id="" name="linkman">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>价格：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" style="width: 30%;" value="{$data.money}" placeholder="" id="" name="money">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>有效期：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" style="width: 30%;" value="<?php $days =  ceil((strtotime($data['valid_date']) - time()) / (24*3600)) ; echo $days ;?>" placeholder="" id="" name="valid_date">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>管理密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" style="width: 30%;" value="{$data.password}" placeholder="" id="" name="password">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>置顶性质：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width: 30%;"> <span class="select-box">
				<select name="type" class="select">
					<?php foreach(C('info_type') as $k => $v){?>
					<option value="<?php echo $k;?>" <?php if($data['type'] == $k){?> selected="selected" <?php } ?> ><?php echo $v;?></option>
					<?php } ?>
				</select>
				</span> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>状态：</label>
			<div class="formControls col-xs-8 col-sm-9" style="width: 30%;"> <span class="select-box">
				<select name="status" class="select">
					<option value="1" <?php if($data['status'] == 1){?> selected="selected" <?php } ?> >通过审核</option>
					<option value="0" <?php if($data['status'] == 0){?> selected="selected" <?php } ?> >待审核</option>
					<option value="2" <?php if($data['status'] == 2){?> selected="selected" <?php } ?> >审核未通过[不符合要求]</option>
				</select>
				</span> </div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">手机：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.phone}" placeholder="" id="" name="phone">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">电话：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.tel}" placeholder="" id="" name="tel">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">QQ：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.qq}" placeholder="" id="" name="qq">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">缩略图：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div id="swfupload-control">
					<table width="100%" border="0">
						<tr>
							<td width="130"><input type="button" id="button"/></td>
							<td><span
									style="line-height:40px; font-size:12px; color:#000000; letter-spacing:1px; color:#333333;">可一次上传最多<strong>6</strong>张图片，每张图片请小于3.00M。</span>
							</td>
						</tr>
					</table>
					<ul id="preview">
						<?php $pic = explode(',',$data['images']); foreach($pic as $k => $v){?>
							<?php if(empty($v)){ continue ;} ?>
							<li class="success" id="SWFUpload_0_0_<?php echo $k;?>">
								<div class="pic" id="picSWFUpload_0_0_<?php echo $k;?>"><img
										src="/UploadFiles/info/thum/600_600/<?php echo $v;?>"
										id="imgSWFUpload_0_0_<?php echo $k;?>"></div>
								<div class="progressbar">
									<div style="width: 100%;" class="progress"></div>
								</div>
								<p class="status">100%上传成功! | <span class="cancel"
																	onclick="delPic('SWFUpload_0_0_<?php echo $k;?>')">删除</span>
								</p></li>
						<?php } ?>
					</ul>
				</div>
				<input type="hidden" name="thum" id="pic" value="{$data.images}"/>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>内容：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<script id="content" name="content" type="text/plain"  style="min-height: 300px;">
					{$data.content}
				</script>
				<p class="textarea-numberbar"></p>
			</div>
		</div>

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button  class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存提交</button>
			</div>
		</div>
	</form>
</div>

<!---->
<script type="text/javascript" src="__STATIC__admin/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="__STATIC__jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__jquery.validation/1.14.0/messages_zh.min.js"></script>

<script type="text/javascript" src="/Template/default/js/swfupload.js"></script>
<script type="text/javascript" src="/Template/default/js/jquery.swfupload.js"></script>
<script type="text/javascript">
	function _q(obj)

	{

		return document.getElementById(obj);

	}
	var s1;
	$(function () {
		$('#swfupload-control').swfupload({
				upload_url: "{:U('info/post/uploadImg')}",
				file_post_name: 'uploadfile',
				file_size_limit: "10240",
				file_types: "*.gif;*.jpg;*.jpeg;*.png",
				file_types_description: "Image files",
				file_upload_limit: 6,
				flash_url: "/Template/default/js/swfupload.swf",
				button_image_url: '/Template/default/images/button.png',
				button_width: 114,
				button_height: 30,
				button_placeholder: $('#button')[0],
				debug: false,
				button_action: SWFUpload.BUTTON_ACTION.SELECT_FILE,
			})
			.bind('fileQueued', function (event, file) {
				var listitem = '<li id="' + file.id + '" >' +
					'<div class="pic" id="pic' + file.id + '"></div>' +
					'<div class="progressbar" ><div class="progress"></div></div>' +
					'<p class="status" >等待上传 | <span class="cancel">删除</span></p>' +
					'</li>';
				$('#preview').append(listitem);
				$('li#' + file.id + ' .cancel').bind('click', function () {
					var swfu = $.swfupload.getInstance('#swfupload-control');
					swfu.cancelUpload(file.id);
					$('li#' + file.id).slideUp('fast');
				});
				// start the upload since it's queued
				$(this).swfupload('startUpload');
			})
			.bind('fileQueueError', function (event, file, errorCode, message) {
				if (errorCode == '-100') {
					alert('最多可以上传6张图片！');
				}
				else {
					alert('图片：【' + file.name + '】过大，单张图片请不要超过3.00M！');
				}
			})
			.bind('fileDialogComplete', function (event, numFilesSelected, numFilesQueued) {
				$('#queuestatus').text('');
			})
			.bind('uploadStart', function (event, file) {
				$('#preview li#' + file.id).find('p.status').text('0%上传中...');
				$('#preview li#' + file.id).find('span.cancel').hide();
			})
			.bind('uploadProgress', function (event, file, bytesLoaded) {
				//Show Progress
				var percentage = Math.round((bytesLoaded / file.size) * 100);
				$('#preview li#' + file.id).find('div.progress').css('width', percentage + '%');
				$('#preview li#' + file.id).find('p.status').text(percentage + '%上传中...');
			})
			.bind('uploadSuccess', function (event, file, serverData) {
				var item = $('#preview li#' + file.id);
				item.find('div.progress').css('width', '100%');
				item.addClass('success').find('p.status').html('100%上传成功! | <span class="cancel" onclick="delPic(\'' + file.id + '\')">删除</span>');
				_q("pic" + file.id).innerHTML = '<img src="' + serverData + '" id="img' + file.id + '" />';
				_q("pic").value += serverData + ",";
			})
			.bind('uploadComplete', function (event, file) {
				// upload has completed, try the next one in the queue
				$(this).swfupload('startUpload');
			});
//		if (getCookie("qth8") != null && getCookie("qth8") != "") {
//			if (_q("pic").value != "") {
//				arrPic = _q("pic").value.split(",");
//				var picCount = 0;
//				for (t = 0; t < arrPic.length; t++) {
//					if (arrPic[t] != "") {
//						picCount++;
//						_q("preview").innerHTML += '<li id="' + t + '" >' +
//							'<div class="pic" id="pic' + t + '"><img src="' + arrPic[t] + '" id="img' + t + '" /></div>' +
//							'<div class="progressbar" ><div class="progress"></div></div>' +
//							'<p class="status" >100%上传成功! | <span class="cancel" onclick="delPic(\'' + t + '\')">删除</span></p>' +
//							'</li>';
//					}
//				}
//			}
//		}

	});

	function delPic(pid) {
		var picPath = _q("img" + pid).src;
		$('li#' + pid).slideUp('fast');
		var swfu = $.swfupload.getInstance('#swfupload-control');
		var stats = swfu.getStats();
		stats.successful_uploads--;
		swfu.setStats(stats);
		var picArr = _q("pic").value.split(',');
		_q("pic").value = "";
		for (i = 0; i < picArr.length; i++) {
			if (picPath.indexOf(picArr[i]) < 0) {
				_q("pic").value += picArr[i] + ",";
			}
		}
	}

	$(function(){

		$("#form").validate({
			rules: {
				title: "required",
				linkman: "required",
				valid_date: "required",
				password: "required",
				content: "required",
			},
			messages: {
				title: "该项不能为空",
				linkman: "该项不能为空",
				valid_date: "该项不能为空",
				password: "该项不能为空",
				content: "该项不能为空",
			}
		});

	})
</script>
<style type="text/css">
	#swfupload-control p {
		margin: 10px 5px;
		line-height: 25px;
		height: 25px;
		color: #666666;
		font-size: 12px;
	}

	#preview {
		margin: 0;
		padding: 0;
		width: 500px;
	}

	#preview li {
		list-style: none;
		margin: 2px;
		border: 1px solid #ccc;
		padding: 5px;
		font-size: 12px;
		font-family: Arial, Helvetica, sans-serif;
		color: #333;
		float: left;
		width: 140px;
		height: auto;
		background: #fff;
		position: relative;
	}

	#preview li .progressbar {
		border: 0px solid #333;
		height: 5px;
		overflow: hidden;
		margin-top: 3px;
		background: #fff;
	}

	#preview li .progress {
		background: #009900;
		width: 0%;
		height: 5px;
	}

	#preview li p {
		margin: 0;
		line-height: 18px;
	}

	#preview li.success {
		border: 1px solid #cccccc;
		background: #ffffff;
	}

	#preview li span.cancel {
		cursor: pointer;
	}

	#preview li .pic {
		width: 140px;
		height: 110px;
	}

	#preview li .pic img {
		width: 140px;
		height: 110px;
	}

	.messbox10 {
		width: 186px;
		height: 210px;
		background-image: url(__THEME_PATH__images/messlistbg.gif);
		background-color: #FFFFFF;
		line-height: 20px;
		font-size: 14px;
		float: left;
		overflow: hidden;
		margin-right: 8px;
		margin-bottom: 8px;
		position: relative;
	}

	.messbox10 .boxContent a {
		text-decoration: none;
		color: #0066cc
	}

	.messbox10 .boxContent {
		font-size: 12px;
		color: #333333;
		font-family: Verdana, Arial, "宋体";
		letter-spacing: 0px;
	}

	.boxTitle {
		height: 40px;
		padding: 5px;
		overflow: hidden;
		line-height: 20px;
		text-align: center;
	}

	.boxTitle a {
		color: #197ac5;
		text-align: center;
		font-weight: lighter;
		text-decoration: none;
	}

	.boxName {
		color: #666666;
	}

	.boxPrice {
		position: absolute;
		font-size: 16px;
		font-family: Arial, "宋体";
		font-weight: bolder;
		color: #ff3300;
		top: 188px;
		right: 5px;
		letter-spacing: 0px;
	}

	.boxPrice strong {
		font-size: 12px;
		font-weight: lighter;
		font-family: "Microsoft Yahei", "微软雅黑", Tahoma, Arial, Helvetica, STHeiti;
		color: #666666;
	}

	.boxPrice span {
		font-size: 12px;
		font-weight: lighter;
	}

	.boxContent {
		color: #333333;
		line-height: 18px;
		font-size: 12px;
		padding: 3px 8px 8px 8px;
		padding-bottom: 0px;
	}

	.boxContact {
		color: #333333;
		letter-spacing: 0px;
		width: 210px;
		height: auto;
		padding: 8px;
		padding-top: 0px;
		line-height: 18px;
		overflow: hidden;
		font-size: 12px;
	}

	.boxContact img {
		vertical-align: middle;
		position: static;
	}

	.boxContact a {
		color: #333333;
		text-decoration: none;
	}

	.boxContact .num {
		font-size: 14px;
		letter-spacing: 0px;
		cursor: pointer
	}

	.boxDate {
		font-size: 12px;
		position: absolute;
		font-family: Arial, "宋体";
		color: #333333;
		line-height: 15px;
		top: 190px;
		left: 5px;
	}

	.boxDateOver {
		color: #999999;
	}
</style>



<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
	var ue = UE.getEditor('content');
</script>

</body>
</html>